package com.nsgf.library.data.bean;

import androidx.annotation.ColorInt;

import com.nsgf.library.utils.StringUtil;

import java.util.List;

public class DeviceOpeningBean {

    private int id;
    private String facilityName;
    private String facilityCode;
    private String facilityType;
    private String facilityTypeDesc;
    private List<Devices> devices;

    public void setId(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setFacilityName(String facilityName) {
        this.facilityName = facilityName;
    }

    public String getFacilityName() {
        return facilityName;
    }

    public void setFacilityCode(String facilityCode) {
        this.facilityCode = facilityCode;
    }

    public String getFacilityCode() {
        return facilityCode;
    }

    public void setFacilityType(String facilityType) {
        this.facilityType = facilityType;
    }

    public String getFacilityType() {
        return facilityType;
    }

    public void setFacilityTypeDesc(String facilityTypeDesc) {
        this.facilityTypeDesc = facilityTypeDesc;
    }

    public String getFacilityTypeDesc() {
        return facilityTypeDesc;
    }

    public void setDevices(List<Devices> devices) {
        this.devices = devices;
    }

    public List<Devices> getDevices() {
        return devices;
    }

    public static final class Devices {

        private int id;
        private String deviceName;
        private String deviceCode;
        private String facilityType;
        private String facilityTypeDesc;
        private String pictureUrl;
        private String deviceType;
        private String deviceTypeDesc;
        private String constructionTime;
        private String supplier;
        private String specModel;
        private String location;
        private String remark;
        private int operatingStatus;
        private String duration;
        private String opening;

        public void setId(int id) {
            this.id = id;
        }

        public int getId() {
            return id;
        }

        public void setDeviceName(String deviceName) {
            this.deviceName = deviceName;
        }

        public String getDeviceName() {
            return deviceName;
        }

        public String getDeviceNameSrc() {
            return deviceName + "开高(m)";
        }

        public void setDeviceCode(String deviceCode) {
            this.deviceCode = deviceCode;
        }

        public String getDeviceCode() {
            return deviceCode;
        }

        public void setFacilityType(String facilityType) {
            this.facilityType = facilityType;
        }

        public String getFacilityType() {
            return facilityType;
        }

        public void setFacilityTypeDesc(String facilityTypeDesc) {
            this.facilityTypeDesc = facilityTypeDesc;
        }

        public String getFacilityTypeDesc() {
            return facilityTypeDesc;
        }

        public void setPictureUrl(String pictureUrl) {
            this.pictureUrl = pictureUrl;
        }

        public String getPictureUrl() {
            return pictureUrl;
        }

        public void setDeviceType(String deviceType) {
            this.deviceType = deviceType;
        }

        public String getDeviceType() {
            return deviceType;
        }

        public void setDeviceTypeDesc(String deviceTypeDesc) {
            this.deviceTypeDesc = deviceTypeDesc;
        }

        public String getDeviceTypeDesc() {
            return deviceTypeDesc;
        }

        public void setConstructionTime(String constructionTime) {
            this.constructionTime = constructionTime;
        }

        public String getConstructionTime() {
            return constructionTime;
        }

        public void setSupplier(String supplier) {
            this.supplier = supplier;
        }

        public String getSupplier() {
            return supplier;
        }

        public void setSpecModel(String specModel) {
            this.specModel = specModel;
        }

        public String getSpecModel() {
            return specModel;
        }

        public void setLocation(String location) {
            this.location = location;
        }

        public String getLocation() {
            return location;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public String getRemark() {
            return remark;
        }

        public void setOperatingStatus(int operatingStatus) {
            this.operatingStatus = operatingStatus;
        }

        public int getOperatingStatus() {
            return operatingStatus;
        }

        public void setDuration(String duration) {
            this.duration = duration;
        }

        public String getDuration() {
            return StringUtil.isEmpty(duration) ? "--" : duration;
        }

        public void setOpening(String opening) {
            this.opening = opening;
        }

        public String getOpening() {
            return StringUtil.isEmpty(opening) ? "--" : opening;
        }

        /**
         * 判断设备是否运行中
         */
        public boolean isRunning() {
            return 1 == operatingStatus;
        }

        /**
         * 获取状态文本（用于DataBinding）
         */
        public String getStatusText() {
            return isRunning() ? "(运行)" : "(关闭)";
        }

        /**
         * 获取状态文本颜色（用于DataBinding）
         */
        @ColorInt
        public int getStatusTextColor() {
            return isRunning() ? 0xFF219EFF : 0xFF9CA3AF; // 运行:蓝色, 关闭:灰色
        }
    }
}
